LEADTOOLS Barcode (Leadtools.Barcode assembly)
LEAD Technologies, Inc

ReadBarcodes(RasterImage,LeadRect,Int32,BarcodeSymbology[]) Method

Example 







A Leadtools.RasterImage object that contains the image data. Must not be null.
A Leadtools.LeadRect that specifies the region of interest area in the image where the barcodes search and detection is performed. You can specify empty rectangle to indicate that the search must be performed on the whole image.
An System.Int32 that specifies the maximum number of barcodes to return. Must be a value greater than or equal to 0. The value of 0 means all barcodes.
An array of BarcodeSymbology enumeration members that specifies the barcode symbologies (types) to search for.

For information about this method please see ReadBarcodes(RasterImage,LogicalRectangle,Int32,BarcodeSymbology[]).

.NET support WinRT support
Syntax
'Declaration
 
Public Overloads Function ReadBarcodes( _
   ByVal image As RasterImage, _
   ByVal searchBounds As LeadRect, _
   ByVal maximumBarcodes As Integer, _
   ByVal symbologies() As BarcodeSymbology _
) As BarcodeData()
'Usage
 
Dim instance As BarcodeReader
Dim image As RasterImage
Dim searchBounds As LeadRect
Dim maximumBarcodes As Integer
Dim symbologies() As BarcodeSymbology
Dim value() As BarcodeData
 
value = instance.ReadBarcodes(image, searchBounds, maximumBarcodes, symbologies)
ObjectiveC Syntax
 function Leadtools.Barcode.BarcodeReader.ReadBarcodes(RasterImage,LeadRect,Int32,BarcodeSymbology[])( 
   image ,
   searchBounds ,
   maximumBarcodes ,
   symbologies 
)

Parameters

image
A Leadtools.RasterImage object that contains the image data. Must not be null.
searchBounds
A Leadtools.LeadRect that specifies the region of interest area in the image where the barcodes search and detection is performed. You can specify empty rectangle to indicate that the search must be performed on the whole image.
maximumBarcodes
An System.Int32 that specifies the maximum number of barcodes to return. Must be a value greater than or equal to 0. The value of 0 means all barcodes.
symbologies
An array of BarcodeSymbology enumeration members that specifies the barcode symbologies (types) to search for.

Return Value

An array of BarcodeData objects that contains the symbology, data, location and any rotation angle for each barcode found. If no barcodes can be found, then this method will return an empty array (Length equals to 0).
Remarks

Note: In LEADTOOLS for .NET, the equivalent to Leadtools.LeadRect is Leadtools.Forms.LogicalRectangle.

Example
Copy CodeCopy Code  
[TestMethod]
public async Task BarcodeReader_ReadBarcodeExample5()
{
   string imageFileName = @"Assets\Barcode2.tif";
   // Create a Barcode engine
   BarcodeEngine engine = new BarcodeEngine();

   // Get the Barcode reader instance
   BarcodeReader reader = engine.Reader;

   using(RasterCodecs codecs = new RasterCodecs())
   {
      StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(imageFileName);
      using(RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile)))
      {
         // We are interested in QR and Datamatrix barcodes only
         BarcodeSymbology[] symbologies =
         {
            BarcodeSymbology.QR,
            BarcodeSymbology.Datamatrix
         };

         // Tead the barcodes
         Debug.WriteLine("Reading only QR and Datamatrix barcodes");
         BarcodeData[] barcodes = reader.ReadBarcodes(image, LeadRectHelper.Empty, 0, symbologies);
         if (barcodes == null)
         {
            Debug.WriteLine("No barcodes found");
            return;
         }

         // Show the location and data if found for each barcode
         foreach(BarcodeData barcode in barcodes)
         {
            // This will find the barcode and print its information now
            Debug.WriteLine("Found a {0} barcode at {1}, data:\n{2}", barcode.Symbology, barcode.Bounds, barcode.Value);
         }
      }
   }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

BarcodeReader Class
BarcodeReader Members
Overload List

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Barcode requires a Barcode Module license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features